<template>
  <el-upload v-bind="$attrs" v-on="$listeners" :file-list="_value" action="#">
    <div v-if="!$attrs.drag">
      <el-button size="small" :disabled="$attrs.disabled" type="primary">点击上传</el-button>
      <div slot="tip" class="el-upload__tip">{{ $attrs.tip ?? '只能上传jpg/png文件，且不超过500kb' }}</div>
    </div>
    <div v-if="$attrs.drag">
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div class="el-upload__tip" slot="tip">{{ $attrs.tip ?? '只能上传jpg/png文件，且不超过500kb' }}</div>
    </div>
  </el-upload>
</template>

<script>
import componentMixins from "@/components/ProForm/componentMixins";

export default {
  name: "Input",
  mixins: [componentMixins],
  props: ['value'],
}
</script>

<style lang="scss" scoped>
.el-upload-dragger .el-icon-upload {
  margin: 20px 0 10px;
}
</style>
